/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ASTEC.DaoImpl;
import java.io.Serializable;
import ASTEC.Dao.SolicitudDAO;
import ASTEC.Dominio.Solicitud;
import ASTEC.Util.HibernateUtil;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 *
 * @author Evelyn
 */
public class SolicitudDaoImpl implements SolicitudDAO , Serializable{
    
   public boolean AgregarSolicitud(Solicitud s) {
          Transaction tx = null;
        try {
            Session session = HibernateUtil.getSessionFactory().openSession();
            tx = session.beginTransaction();            
            session.save(s);
            session.beginTransaction().commit();
            session.close();
            return true;
        } catch (HibernateException e) {
            if (tx != null) {
                tx.rollback();
            }
            System.out.println("Error: " + e.getMessage());
            return false;
        }
    }   
    
  
    
}
